package goleetcode

import "duan.com/leetcode/utils"
func removeNodes(head *utils.ListNode) *utils.ListNode {
	// you are given the head of a linked list, remove every node which has a node with a greater value anywhere to the right side of it.
	// return the head of the modified linked list.
	if head == nil {
		return nil
	}
	head.Next = removeNodes(head.Next)
	if(head.Next != nil && head.Val < head.Next.Val) {
		return head.Next
	} else {
		return head
	}
}